home *** CD-ROM | disk | FTP | other *** search
/ Macwelt 1 / Macwelt DVD 1.toast / Web-Publishing / HTML-Editoren / Alpha ƒ / Help / Statistical Modes Help < prev    next >
Encoding:
Text File  |  2001-01-04  |  38.4 KB  |  1,115 lines

  1.  
  2. Statistical Modes Help
  3.  
  4.  
  5.                                        help version: 2.1
  6.                                             created: 03/07/00 {01:10:49 am}
  7.                                         last update: 01/04/01 {09:45:12 am}
  8.  
  9.  
  10. This document describes four statistical modes for the software Alpha.  
  11. They include SAS, S (for S, S-Plus, and R), SPSS, and Stta (Stata).
  12.  
  13. This help manual is rather long, because it deals with all four of these
  14. modes -- each section assumes that you didn't read anything about the
  15. others.  The "General Notes" section, however, does contain information
  16. that relates to all of them.
  17.  
  18.  
  19.           Description of files
  20.  
  21.  
  22. The first four contain the bulk of each mode's variables and procedures: 
  23.  
  24.     SAS     "sasMode.tcl"     (version 2.1)
  25.     S       "sMode.tcl"       (version 2.1)
  26.     SPSS    "spssMode.tcl"    (version 2.1)
  27.     Stta    "stataMode.tcl"   (version 2.1)
  28.  
  29.  
  30. The next eight are for <mode>Completions, and Completion Tutorials:
  31.  
  32.     "SASCompletions.tcl"
  33.     "SAS Tutorial.sas"
  34.             
  35.     "SCompletions.tcl"
  36.     "S Tutorial.s"
  37.             
  38.     "SPSSCompletions.tcl"
  39.     "SPSS Tutorial.sps"
  40.             
  41.     "SttaCompletions.tcl"
  42.     "Stta Tutorial.do"
  43.         
  44. Finally, there is one help file (the one you're currently reading):
  45.  
  46.     Statistical Modes Help
  47.  
  48.  
  49.           General Notes About The Modes
  50.  
  51.  
  52. (1)  These modes serve primarily to make it easier to write statistical 
  53.      syntax files -- they colorize, and set some electric, word break, 
  54.      and commenting preferences.  
  55.      
  56.      Each mode includes its own menu, allowing Alpha to act as a "front
  57.      end" for the Macintosh version of the application.  (Note that in some 
  58.      cases the processing of files or selections may still be in beta stage.)
  59.  
  60.      The menu for each mode includes "Help", "Keywords", and "Mark As" 
  61.      submenus that contain items for obtaining command information, 
  62.      setting mode specific preferences, checking or adding new keywords, and 
  63.      marking the current window as either source or output files.
  64.  
  65. (2)  Each mode contains a full set of electric completions, as well as a 
  66.      Completions Tutorial via the  "Config --> Mode Prefs"  menu item.
  67.  
  68. (3)  Example syntax files are available via the "Mode Examples Help" file. 
  69.      If you open an example syntax file through the provided hyperlinks, it
  70.      will open in a "shell" window.  After you close the window, clicking
  71.      on the hyperlink will return the unblemished original.
  72.  
  73. (4)  All of these modes allow for user customization of keyword dictionaries 
  74.      via the  "Config --> Mode Prefs --> Preferences"  dialog.  New keywords 
  75.      and color changes will take effect immediately, without the need for 
  76.      a restart or changing windows.  Keywords can also be added using some 
  77.      of the menu items found in each menu's "Keywords" submenu -- using the 
  78.      "Add New Commands" item, you can optionally add all of the "extra" 
  79.      commands which appear in the current window.
  80.  
  81.      Each section below includes a brief overview of the statisitical
  82.      package's nomenclature, and a hyperlink to the installed .tcl file
  83.      which contains the keyword dictionaries.
  84.  
  85. (5)  Instructions for editing a <mode>Prefs.tcl file are given in each 
  86.      section.  Any keywords added will not only be colorized, but included
  87.      in the completions routines as well.
  88.  
  89. (6)  All of these modes use the Electric Return, Tab, and Braces features.
  90.      These could, of course, be turned off.  Each mode recognizes both
  91.      the continuation and the end of commands, indenting appropriately. 
  92.      The indentation amount can be set in the "Config --> Electrics" menu.
  93.      
  94.      One could also take advantage of Alpha's "electric return override"
  95.      key binding.  Pressing control-return will place the cursor on the
  96.      next line without any indentation.
  97.  
  98. (7)  Each mode has navigation menu items, bound to control-shift N and P.  
  99.      These items are also bound to control-shift arrow keys, and to 1 and 3
  100.      on the keypad when the num-lock is turned off.  
  101.      
  102.      Control-shift up and down will find the prev/next command.  The right
  103.      and left arrow keys not only find prev/next commands, but will also
  104.      place the cursor at the top of the window.
  105.  
  106. (8)  Each mode has its own indentation scheme, based upon unbalanced braces
  107.      and (for Stata, SPSS, and SAS) on whether the previous command was
  108.      properly terminated.  Entire commands can also be highlighted with
  109.      control-shift S, or reformatted (aligning indentation) with
  110.      control-command I. 
  111.     
  112.      The "Full Indent" mode preference determines if continued commands are
  113.      indented to the full "Indentation Amount" (which can be set using
  114.      "Config --> Preferences --> Electrics" menu item), or just half of
  115.      this value.
  116.  
  117. (9)  Each mode has Mark File [M] and Parse Function {} capabilities.  
  118.      Each marking routine can recognize either source or output files.
  119.  
  120.      Selecting the "Auto Mark" preference, available as a toggleable menu
  121.      item in each mode's "Mark As…" submenu, will automatically mark a file
  122.      when it is opened, assuming that no previous marks yet exist for the
  123.      file.
  124.  
  125. (10) Finally, on-line help is available for each mode through command 
  126.      double-clicking.  The url to which the keywords are sent can be
  127.      configured the the "Mode Prefs --> Preferences" dialog.  Each menu
  128.      also includes a "Home Page" option, using the url set in this dialog.
  129.  
  130.           
  131.     ======================================================================
  132.  
  133.  
  134.           SAS 
  135.  
  136.  
  137. This is also a goood mode for reading SAS output files.  One could easily 
  138. add a preference in the "Config --> Preferences --> Suffix Mappings" menu 
  139. item to automatically recognize .lst or .log files.
  140.  
  141. Example syntax file:  "SAS Example.sas"
  142.  
  143.  
  144.                SAS Keywords
  145.  
  146.  
  147. SAS seems to have five levels of possible keywords, all of which can be 
  148. reviewed in "sasMode.tcl" :
  149.  
  150.   1. the top level "proc" command:  anova, freq, varcomp
  151.   2. sub-level procs, or "subprocs":  rename, value, range
  152.   2. "arguments", which require no parameters:  ls, missover, in1
  153.   3. "options", which require parameters:  converge, data, gamma
  154.   4. "parameters", preset as opposed to user supplied: full, part  
  155.  
  156. The default setup of this mode is to colorize all of procs and subprocs
  157. blue; arguments, options, and parameters are magenta.  The user does not
  158. have to specify all of these different levels -- only Argument, Command,
  159. Comment, String, and Symbol colors appear in the preferences.
  160.  
  161. Each of these commands has an electric completion available, and the mode
  162. comes with a Completions Tutorial, available in the "Config --> Mode Prefs"
  163. menu item.  Using the completion key, which can be defined with the menu
  164. item "Config --> Special Keys", the user can type
  165.  
  166.     p'ano<complete>
  167.  
  168. and Alpha will automatically insert the following text:
  169.  
  170.     proc anova | ;
  171.     •
  172.  
  173. The template stops will allow the user to use the tab key to jump ahead to 
  174. insert the needed variable names, and the last stop will position the 
  175. cursor for the next command.
  176.  
  177. Additional commands and arguments can be added in two ways, through the
  178. Mode Preferences menu item, and in a SASPrefs.tcl file.  Extra keywords
  179. defined (using either method) will be included in the electric completion
  180. routines.  The "Keywords --> Add Commands" menu item will give you the 
  181. option to add all "extra" commands in the current file to the "addCommands" 
  182. mode preference.
  183.  
  184. Completions Tutorial: "SAS Tutorial.sas"
  185.  
  186.  
  187.                SAS Menu
  188.  
  189.  
  190.     Switch To SAS
  191.  
  192. Launch SAS into foreground.
  193.  
  194.     Process File
  195.     Process Selection
  196.  
  197. Send window (or the highlighted selection) to SAS for processing.
  198.  
  199.     Insert Path
  200.  
  201. Open a dialog to select a file, and then insert the file's pathname.
  202.  
  203.     Next Command
  204.     Prev Command
  205.  
  206. Navigate the current window, defining the next/prev command based upon 
  207. non-commented text in column 1 of any row.
  208.  
  209. Navigation commands are also bound to control-shift arrow keys, as well as 
  210. the 1 and 3 keys on the keypad when num-lock is turned off.
  211.  
  212.     Select Command
  213.  
  214. Select the entire command to its termination.
  215.  
  216.     Reformat Command
  217.  
  218. Reformat the current command surrounding the cursor, aligning indentation.
  219.  
  220.  
  221.  
  222.                SAS command double-click
  223.  
  224.  
  225. On-line help is available for SAS commands through command-double-clicking. 
  226.  
  227. SAS provides a help file suite called SAS OnlineDoc.  The license agreement
  228. suggests that access should be restricted to users within a particular
  229. domain.  If you have access to this set of files (either locally on your
  230. hard drive or within via a protected domain location), you should set the
  231. url preference in the mode preferences dialog.
  232.  
  233. (Occassionally you can find versions that are open to the public.  Try the
  234. search term "SAS Online Doc".)
  235.  
  236. Any available syntax information is also available by pressing the control 
  237. key while command-double-clicking.  This information will appear in the 
  238. status bar window.  In some cases, this information is too long to be read 
  239. in its entirety.  Pressing the shift key instead of the control key will 
  240. insert this syntax information as commented text into your current window.
  241.  
  242. NOTE: These control-command and shift-command double-click features have
  243. not been fully implemented.  See the "SASCompletions.tcl" file for
  244. additional information.
  245.  
  246.  
  247.  
  248.                SAS File Marking
  249.  
  250.  
  251. For SAS mode, Mark File will return the first 35 characters of each command
  252. which begins a new line.  Therefore it should not include any indented or
  253. continued commands.  Headings will be marked, defined by three (and only
  254. three) comment characters and a space at the start of a line.  Subheadings
  255. are indicated by four comment characters.
  256.  
  257.  
  258.     The File                    The Mark
  259.     ________                    ________
  260.  
  261.     *** Section Heading         • Section Heading
  262.     **** Subsection Heading     * Subsection Heading
  263.     command varlist (options)     command varlist (options)
  264.  
  265.  
  266. Function parsing {} will return only the command name, in alphabetical order.
  267.  
  268. Mark File mode will check to see if the current window is a .sas file.  If
  269. it is not, it will assume that it is an output file, and Alpha will adjust
  270. its marking and parsing routines accordingly.
  271.  
  272.  
  273.                Adding an SAS Prefs file
  274.  
  275.  
  276. To add additional commands or arguments in a "SASPrefs.tcl" file, go to
  277. "Config --> Mode Prefs --> Edit Prefs File", and add these lines:
  278.  
  279.  
  280.     set SASUserCommands {
  281.         blah bladdity
  282.     }
  283.     
  284.     set SASUserArguments {
  285.         blah2 bladdity2
  286.     }
  287.     
  288.     SAS::colorizeSAS
  289.  
  290.  
  291. Include as many keywords as desired within the braces, separating each
  292. keyword by at least one space or carriage return.  Alpha will automatically
  293. load this preferences file the first that the SAS mode is invoked.
  294.  
  295. Any keywords contained in these categories will not only be colorized, but
  296. will also be included as electric completions.  Don't repeat commands or
  297. arguments that have already been defined.
  298.  
  299.           
  300.     ======================================================================
  301.  
  302.  
  303.           S  (S-Plus, R)
  304.  
  305.  
  306. This mode is for editing S source files.  Keywords are primarily based on
  307. release number 3.3, taken from the 'common commands' as listed in Venable
  308. and Ripley's Modern Applied Statistics with S-PLUS, second edition.  This
  309. would be a good mode for R files, too, but the C mode has already laid
  310. claim to the suffix .r  -- this could be changed in Alpha's suffix mappings.
  311.  
  312. Example syntax file:  "S Example.s"
  313.  
  314.  
  315.                S-Plus Keywords
  316.  
  317.  
  318. S-Plus is remarkably elegant in structure.  Commands have arguments, and
  319. rarely does the language use the same names for both.  There are a few
  320. exceptions, which reside in the Arguments category.  These exceptions could
  321. be changed to commands through the "Mode Prefs --> Preferences" dialog.
  322.  
  323. The Venable and Ripley MASS library can also be included in keyword lists for 
  324. both colorizing and completions by checking the Use Mass Library preference.
  325.  
  326. Keywords can be reviewed in "sMode.tcl" .
  327.  
  328. Each of these commands has an electric completion available, and the mode
  329. comes with a Completions Tutorial, available in the "Config --> Mode Prefs"
  330. menu item.  Using the completion key, which can be defined with the menu
  331. item "Config --> Special Keys", the user can type
  332.  
  333.     glm<complete>
  334.  
  335. and Alpha will automatically insert the following text:
  336.  
  337.     glm(| ~ •)•
  338.     •
  339.  
  340. The template stops will allow the user to use the tab key to jump ahead to 
  341. insert the needed variable names, and the last stop will position the 
  342. cursor for the next command.
  343.  
  344. Additional commands and arguments can be added in two ways, through the
  345. Mode Preferences menu item, and in an SPrefs.tcl file.  Extra keywords
  346. defined (using either method) will be included in the electric completion
  347. routines.  The "Keywords --> Add Commands" menu item will give you the
  348. option to add all "extra" commands in the current file to the "addCommands"
  349. mode preference.
  350.  
  351.  
  352. Completions Tutorial: "S Tutorial.s"
  353.  
  354.  
  355.                S mode Carriage Returns
  356.  
  357.  
  358. S mode has its own indentation scheme, based upon unbalanced braces, and
  359. uses the Electric Return, Tab and Braces features.  Each time that you
  360. start a new line with the <return> key, the previous non-commented line is
  361. evaluated for unmatched ( and ) -- ignoring any braces that appear within
  362. double quotes or after valid comment characters.
  363.  
  364. Lines that begin with ) will have their indentation reduced by one level to
  365. match the line with the matching (, as in
  366.  
  367.     for (i in 1:length(data03.1$year)){
  368.         data03.1$year <- as.vector(data03.1$year)
  369.         if(data03.1$year[i] == "1965-70") (
  370.             data03.1$year[i] <- c("1965-69")
  371.         )
  372.     }
  373.  
  374. In some cases, as when you are continuing a command, you might want to
  375. over-ride this behavior.  For example, if you type
  376.  
  377.     qqno|
  378.  
  379. and press the completion key, the command completes to 
  380.  
  381.     qqnorm(|)••
  382.  
  383. Typing "resid" and pressing the completion key again turns the line into
  384.  
  385.     qqnorm(resid(|)••)••
  386.  
  387. If you type some more text and then press <return>, the next line will
  388. automatically indent to
  389.  
  390.     qqnorm(resid(out3.11), ylab = "deviance residuals",
  391.     |)••
  392.  
  393. which is properly indented.  This would be fine if this line actually
  394. terminated the command, but you might want to continue the command.  To
  395. over-ride this behavior, which in this case would increase the level of
  396. indentation for the next line to 1, press <shift>-<return> instead:
  397.  
  398.     qqnorm(resid(out3.11), ylab = "deviance residuals",
  399.         |)••
  400.  
  401. and then some more text and a regular carriage return will make the command
  402. look like
  403.  
  404.     qqnorm(resid(out3.11), ylab = "deviance residuals",
  405.         xlab = "extremities"
  406.     )
  407.  
  408. Entire commands can also be reformatted (aligning indentation) with
  409. <control>-<command> I.
  410.  
  411. To enter a carriage return with no indentation whatsoever, press 
  412. <control>-<return>.
  413.  
  414.  
  415.                S Menu
  416.  
  417.  
  418.     Switch To S+/R
  419.  
  420. Launch S into foreground.
  421.  
  422.     Process File
  423.     Process Selection
  424.  
  425. Send window (or the highlighted selection) to S+/R for processing.
  426.  
  427.     Insert Path
  428.  
  429. Open a dialog to select a file, and then insert the file's pathname.
  430.  
  431.     Next Command
  432.     Prev Command
  433.  
  434. Navigate the current window, defining the next/prev command based upon 
  435. non-commented text in column 1 of any row.
  436.  
  437. Navigation commands are also bound to control-shift arrow keys, as well as 
  438. the 1 and 3 keys on the keypad when num-lock is turned off.
  439.  
  440.     Select Command
  441.  
  442. Select the entire command to its termination.
  443.  
  444.     Reformat Command
  445.  
  446. Reformat the current command surrounding the cursor, aligning indentation.
  447.  
  448.  
  449.                S command double-click
  450.  
  451.  
  452. On-line help is available for S commands through command-double-clicking.
  453. The URL to which the keywords are sent can be changed through the Mode 
  454. Preferences dialog.
  455.  
  456. Any available syntax information is also available by pressing the control 
  457. key while command-double-clicking.  This information will appear in the 
  458. status bar window.  In some cases, this information is too long to be read 
  459. in its entirety.  Pressing the shift key instead of the control key will 
  460. insert this syntax information as commented text into your current window.
  461.  
  462. NOTE: These control-command and shift-command double-click features have
  463. not been fully implemented.  See the "SCompletions.tcl" file for additional
  464. information.
  465.  
  466.  
  467.                S File Marking
  468.  
  469.  
  470. For S mode, Mark File will return the first 35 characters of each command
  471. which begins a new line.  Therefore it should not include any indented or
  472. continued commands.  Headings will be marked, defined by three (and only
  473. three) comment characters and a space at the start of a line.  Subheadings
  474. are indicated by four comment characters.
  475.  
  476.  
  477.     The File                    The Mark
  478.     ________                    ________
  479.  
  480.     ### Section Heading         • Section Heading
  481.     #### Subsection Heading     * Subsection Heading
  482.     command varlist (options)     command varlist (options)
  483.  
  484.  
  485. Function parsing {} will return only the command names, in alphabetical order.
  486.  
  487.  
  488.                Adding an S Prefs file
  489.  
  490.  
  491. To add additional commands or arguments in an "SPrefs.tcl" file, go to
  492. "Config --> Mode Prefs --> Edit Prefs File", and add these lines:
  493.  
  494.  
  495.     set SUserCommands {
  496.         blah bladdity
  497.     }
  498.     
  499.     set SUserArguments {
  500.         blah2 bladdity2
  501.     }
  502.     
  503.     S::colorizeS
  504.  
  505.  
  506. Include as many keywords as desired within the braces, separating each
  507. keyword by at least one space or carriage return.  Alpha will automatically
  508. load this preferences file the first that the S mode is invoked.
  509.  
  510. Any keywords contained in these categories will not only be colorized, but
  511. will also be included as electric completions.  Don't repeat commands or
  512. arguments that have already been defined.
  513.  
  514.           
  515.     ======================================================================
  516.  
  517.  
  518.           SPSS
  519.  
  520.  
  521. This is also a goood mode for reading SPSS output files.  One could easily 
  522. add a preference in the "Config --> Preferences --> Suffix Mappings" menu 
  523. item to automatically recognize .out or .log files produced by SPSS.
  524.  
  525. Example syntax file:  "SPSS Example.sps"
  526.  
  527.  
  528.                SPSS Keywords
  529.  
  530.  
  531. SPSS does a lousy job of naming things, or at least is more than willing to
  532. give a keyword (as in SPSS keyword) the same name as a function, statement,
  533. subcommand or command.  There's little point in trying to distinguish
  534. amongst all of this with different colors, because it just won't work. 
  535. Instead, they are included one long list, called "commands."  There's also 
  536. a short list of functions (abs, arsin, artan, etc) as well as several 
  537. operators (all, and, by, eq, ge, gt, into, etc).
  538.  
  539. Keywords can be reviewed in "spssMode.tcl" .
  540.  
  541. Each of these commands has an electric completion available, and the mode
  542. comes with a Completions Tutorial, available in the "Config --> Mode Prefs"
  543. menu item.  
  544.  
  545. Additional commands and arguments can be added in two ways, through the
  546. Mode Preferences menu item, and in an SPSSPrefs.tcl file.  Extra keywords
  547. defined (using either method) will be included in the electric completion
  548. routines.  The "Keywords --> Add Commands" menu item will give you the
  549. option to add all "extra" commands in the current file to the "addCommands"
  550. mode preference.
  551.  
  552.  
  553. Completions Tutorial: "SPSS Tutorial.sps"
  554.  
  555.                Non-ambiguous SPSS keywords
  556.  
  557.  
  558. SPSS allows .sps files to contain non-ambiguous command and option 
  559. abbreviations.  It would be nice if Alpha could colorize based upon the 
  560. location of keywords, but as of this writing it cannot.  Creating a list 
  561. of all possible abbreviations is also out of the question, which presents 
  562. a challenge for both this mode's maintainer and the user to effectively 
  563. colorize a syntax file.  Fortunately, two solutions are available.
  564.  
  565. The first is to utilize the electric completions that are available.  Using 
  566. the completion key, which can be defined with the "Config --> Special Keys" 
  567. menu item, the user can type
  568.  
  569.     regr<complete>
  570.  
  571. and Alpha will automatically insert the following text:
  572.  
  573.     regression | • • .
  574.     •
  575.  
  576. The template stops will allow the user to use the tab key to jump ahead to 
  577. insert the needed variable names, and the last stop will position the 
  578. cursor for the next command.  This way unambiguous abbreviations need only 
  579. be typed, though the full command will appear and be colorized.  SPSS mode 
  580. has a completions tutorial available, accessed by "Config --> Mode Prefs".
  581.  
  582. The second solution is to define common abbreviations through either the 
  583. "Config --> Mode Prefs --> Preferences" menu item or a "SPSSPrefs.tcl" file.  
  584. These will be automatically included in the completion routines as well, 
  585. and the actual text to be inserted can be refined by the user using the 
  586. "Config --> Mode Prefs --> Edit Completions" menu item.
  587.  
  588. Completions Tutorial: "SPSS Tutorial.sps"
  589.  
  590.  
  591.                SPSS Menu
  592.  
  593.  
  594.     Switch To SPSS/PSPP
  595.  
  596. Launch SPSS/PSPP into foreground.
  597.  
  598.     Process File
  599.     Process Selection
  600.  
  601. Send window (or the highlighted selection) to SPSS/PSPP for processing.
  602.  
  603.     Insert Path
  604.  
  605. Opens a dialog to select a file, and then inserts the file's pathname.
  606.  
  607.     Next Command
  608.     Prev Command
  609.  
  610. Navigate the current window, defining the next/prev command based upon 
  611. non-commented text in column 1 of any row.
  612.  
  613. Navigation commands are also bound to control-shift arrow keys, as well as 
  614. the 1 and 3 keys on the keypad when num-lock is turned off.
  615.  
  616.     Select Command
  617.  
  618. Select the entire command to its termination.
  619.  
  620.     Reformat Command
  621.  
  622. Reformat the current command surrounding the cursor, aligning indentation.
  623.  
  624.  
  625.                SPSS command double-click
  626.  
  627.  
  628. On-line help is available for SPSS commands through command-double-clicking.
  629. The URL to which the keywords are sent can be changed through the Mode 
  630. Preferences dialog.
  631.  
  632. The default URL is a search engine for the GNU PSPP project.  PSPP is a
  633. statistical analysis program.  It is an upwardly compatible replacement of
  634. the proprietary statistical analysis program SPSS. A main goal of the PSPP
  635. project is compatibility with the SPSS language.  PSPP also aims to be
  636. written better than the program it replaces.  For more information, see
  637.  
  638.     <http://www.gnu.org/software/pspp/>
  639.  
  640.  
  641. Any available syntax information is also available by pressing the control 
  642. key while command-double-clicking.  This information will appear in the 
  643. status bar window.  In some cases, this information is too long to be read 
  644. in its entirety.  Pressing the shift key instead of the control key will 
  645. insert this syntax information as commented text into your current window.
  646.  
  647. NOTE: These control-command and shift-command double-click features have
  648. not been fully implemented.  See the "SPSSCompletions.tcl" file for
  649. additional information.
  650.  
  651.  
  652.  
  653.                SPSS File Marking
  654.  
  655.  
  656. For SPSS mode, Mark File will return the first 35 characters of each command
  657. which begins a new line.  Therefore it should not include any indented or
  658. continued commands.  Headings will be marked, defined by three (and only
  659. three) comment characters and a space at the start of a line.  Subheadings
  660. are indicated by four comment characters.
  661.  
  662.  
  663.     The File                    The Mark
  664.     ________                    ________
  665.  
  666.     *** Section Heading         • Section Heading
  667.     **** Subsection Heading     * Subsection Heading
  668.     command varlist (options)     command varlist (options)
  669.  
  670.  
  671. Function parsing {} will return only the command names, in alphabetical order.
  672.  
  673. Mark File mode will check to see if the current window is a .sps file.  If
  674. it is not, it will assume that it is an output file, and Alpha will adjust
  675. its marking and parsing routines accordingly.
  676.  
  677. There is also a special marking routine for files produced by the FREQ
  678. command, available in the "SPSS --> Mark Spss File As …" menu.  Mark File
  679. will then contain only the variable names, and list them in alphabetical
  680. order.  Extremely handy for data sets with a lot of variables.  (Note that 
  681. because SPSS output doesn't allow for unambiguous recognition of these 
  682. variable names, some might be lost...  I've done the best I could!)
  683.  
  684.  
  685.  
  686.                Adding an SPSS Prefs file
  687.  
  688.  
  689. To add additional commands or arguments in an "SPSSPrefs.tcl" file, go to
  690. "Config --> Mode Prefs --> Edit Prefs File", and add these lines:
  691.  
  692.  
  693.     set SPSSUserCommands {
  694.         blah bladdity
  695.     }
  696.     
  697.     SPSS::colorizeSPSS
  698.  
  699.  
  700. Include as many keywords as desired within the braces, separating each
  701. keyword by at least one space or carriage return.  Alpha will automatically
  702. load this preferences file the first that the SPSS mode is invoked.
  703.  
  704. Any keywords contained in these categories will not only be colorized, but
  705. will also be included as electric completions.  Don't repeat commands or
  706. arguments that have already been defined.
  707.  
  708.           
  709.     ======================================================================
  710.  
  711.  
  712.           Stata
  713.  
  714. This is also a goood mode for reading Stata output files.  One could easily 
  715. add a preference in the "Config --> Preferences --> Suffix Mappings" menu 
  716. item to automatically recognize .out  or .log files.
  717.  
  718. Keywords are based on release 6.0.
  719.  
  720. (Thanks to L. Philip Schumm for several contributions, including the Stata 
  721. menu, the <shift>-<return> key binding, and other useful suggestions.)
  722.  
  723. Example syntax file:  "Stata Example.do"
  724.  
  725.  
  726.                Stata Keywords
  727.  
  728.  
  729. Stata has five levels of processes.
  730.  
  731.   1. commands, subcommands, prefixes:  mlogit, define, quietly, 
  732.   2. parameters:   textsize, maxobs, width, more,
  733.   3. functions:    abs(), log(), sin(), ge, lt,
  734.   4. options: noheader, bar, adjust, iterate
  735.   5. modifiers:    [weights= ], [frequency= ]
  736.  
  737.   and, just to help make sure that everything goes smoothly, we have
  738.  
  739.   6. out of date (or "dated") commands:  genrank, grebar
  740.   
  741. Keywords can be reviewed in "stataMode.tcl" .
  742.  
  743. For the most part, Stata is very good about not using the same name for a
  744. command to refer to a function, parameter, or modifier.  Options, however,
  745. often have the same names as commands.
  746.  
  747. The default setup of this mode is to colorize all of commands, subcommands,
  748. prefixes, parameters, and macros blue.  Options, functions, modifiers, and
  749. symbols are colorized magenta.  Dated commands are red.  The user does not
  750. have to specify all of these different levels -- only Command, Comment,
  751. Option, String, and Symbol colors appear in the preferences.
  752.  
  753. Additional commands and options can be added in two ways, through the Mode
  754. Preferences menu item, and in a SttaPrefs.tcl file.  Extra keywords defined
  755. (using either method) will be included in the electric completion routines. 
  756. The "Keywords --> Add Commands" menu item will give you the option to add
  757. all "extra" commands in the current file to the "addCommands" mode
  758. preference.
  759.  
  760.  
  761.  
  762.                Non-ambiguous Stata abbreviations
  763.  
  764.  
  765. Stata allows .do files to contain non-ambiguous command and option 
  766. abbreviations.  It would be nice if Alpha could colorize based upon the 
  767. location of keywords, but as of this writing it cannot.  Creating a list 
  768. of all possible abbreviations is also out of the question, which presents 
  769. a challenge for both this mode's maintainer and the user to effectively 
  770. colorize a syntax file.  Fortunately, two solutions are available.
  771.  
  772. The first is to utilize the electric completions that are available.  Using 
  773. the completion key, which can be defined with the "Config --> Special Keys" 
  774. menu item, the user can type
  775.  
  776.     mlog<complete>
  777.  
  778. and Alpha will automatically insert the following text:
  779.  
  780.     mlogit  | • •  ;
  781.     •
  782.  
  783. The template stops will allow the user to use the tab key to jump ahead to 
  784. insert the needed variable names, and the last stop will position the 
  785. cursor for the next command.  This way unambiguous abbreviations need only 
  786. be typed, though the full command will appear and be colorized.  Stta mode 
  787. has a completions tutorial available, accessed by "Config --> Mode Prefs".
  788.  
  789. The second solution is to define common abbreviations through either the 
  790. "Config --> Mode Prefs --> Preferences" menu item or a SttaPrefs.tcl file.  
  791. Both methods allow for keywords to be defined as either commands or options.  
  792. The "Keywords --> Add Commands" menu item will give you the option to add
  793. all "extra" commands in the current file to the "addCommands" mode
  794. preference.
  795.  
  796. These will be automatically included in the completion routines as well, 
  797. and the actual text to be inserted can be refined by the user using the 
  798. "Config --> Mode Prefs --> Edit Completions" menu item.
  799.  
  800. Finally, one could always define the Command and Option Colors to be the 
  801. same, which would avoid some (though certainly not all) of these issues.  
  802. Setting both colors to "none" will remove this issue entirely !!
  803.  
  804. Completions Tutorial: "Stta Tutorial.do"
  805.  
  806.  
  807.                Command line delimiter
  808.  
  809.  
  810. In Stata, the end of a command line may be indicated with either a carriage
  811. return or a semicolon.  Carriage return is the default, and most Stata
  812. programmers (including the official code released by StataCorp) stick with
  813. this.  This means that splitting a single command into two or more physical
  814. lines requires using the comment characters /* and */.  
  815.  
  816. The key-binding <shift>-<return> will insert these characters.
  817.  
  818. The "Stata --> Stata Help" menu includes the item "Semi Delimiter", which
  819. should be set if you terminate commands with the semicolon.  This
  820. preference is used in all completion routines, and to determine if the next
  821. line should be indented following a carriage return.  The "Reformat
  822. Command" menu item will also respect this preference when re-aligning
  823. indentation.  The menu item "Indentation Amount" sets the Stta mode
  824. preference of the same name, which determines how much white space will be
  825. inserted when continuing a command.
  826.  
  827.  
  828.                Stata Menu
  829.  
  830.  
  831. Written and maintained by L. Philip Schumm <pschumm@uchicago.edu>
  832.  
  833.  
  834.     Switch To Stata         - launch Stata into foreground.
  835.     
  836. Launch Stata into foreground.
  837.  
  838. From within Alpha, shift-cmd-S will take you to Stata.  And if you do not
  839. have any open applications whose names come before Alpha or after Stata
  840. (alphabetically, that is), then cmd-Tab will take you from Stata back to
  841. Alpha (assuming that you have the Application Switcher enabled and
  842. configured appropriately).  If you need help configuring the Application
  843. Switcher, you may obtain it by looking under the topic "Switching between
  844. open programs" in the Macintosh Help Viewer.
  845.  
  846. Note that launching Stata via the Stata menu has the same result as
  847. double-clicking on the Stata application (as opposed to clicking on a do
  848. file).  This means that when Stata comes up the working directory will be
  849. the same directory in which the Stata application resides, and it is not
  850. generally advisable to save files there.  The best way around this is to
  851. create a profile.do file containing a -cd- command, and place it in this
  852. directory so that it is automatically executed whenever Stata is launched.
  853.  
  854.     Do File
  855.     Do Selection
  856.  
  857. Send window (or the highlighted selection) to Stata for processing.
  858.  
  859. When Stata processes a do-file, it ignores the last line unless the file
  860. ends with a carriage return.  Stata's do-file editor is smart about this,
  861. and automatically adds a carriage return (if necessary) when you save the
  862. file.  Stat mode will add a carriage return (if necessary) when you send a
  863. file to Stata for processing, but will not do so if you simply save the
  864. file.  Keep this in mind.
  865.  
  866.     Insert Path
  867.  
  868. Open a dialog to select a file, and then insert the file's pathname.
  869.  
  870.     Program Template
  871.  
  872. Insert a template for writing a program (useful for simulations and
  873. bootstrapping).  See the notes below on editing a SttaPrefs.tcl file for
  874. information on customizing this template.
  875.  
  876.     Continue Command
  877.  
  878. Continue the current command, by inserting */
  879.     */ at the current location of the cursor.
  880.  
  881.     Next Command
  882.     Prev Command
  883.  
  884. Navigate the current window, defining the next/prev command based upon 
  885. non-commented text in column 1 of any row.
  886.  
  887. Navigation commands are also bound to control-shift arrow keys, as well as 
  888. the 1 and 3 keys on the keypad when num-lock is turned off.
  889.  
  890.     Select Command
  891.  
  892. Select the entire command to its termination.
  893.  
  894.     Reformat Command
  895.  
  896. Reformat the current command surrounding the cursor, aligning indentation.
  897.  
  898.  
  899.                Stata command double-click
  900.  
  901.  
  902. On-line help is available for Stata commands via command-double-clicking. 
  903. The URL to which the keywords are sent can be changed through the Mode
  904. Preferences dialog.  
  905.  
  906. Clicking on a program name that has been defined in the current window will
  907. move the cursor to that program's definition, as in
  908.  
  909.     program define dothis ;
  910.     
  911.         regress `1' ...
  912.         ...
  913.         
  914.     end ;
  915.  
  916. Pressing control-. will return the cursor to its original position.
  917.  
  918.  
  919.                     Control, Shift, Option modifiers
  920.  
  921. Any available syntax information is also available by pressing the control 
  922. key while command-double-clicking.  This information will appear in the 
  923. status bar window.  
  924.  
  925. In some cases, this information is too long to be read in its entirety. 
  926. Pressing the shift key instead of the control key will insert this syntax
  927. information as commented text into your current window.
  928.  
  929. Finally, pressing the option key on a command will open the corresponding
  930. local Stata application .hlp file if it exists.  Note that you can also set
  931. Stata so that it automatically performs a search for the command (or word)
  932. if a .hlp file is not located.  To re-assign command double-click to local
  933. search as well (without having to using the option modifier), check the
  934. "Local Help Only" box in the Mode Preferences.
  935.  
  936.  
  937.                Stata File Marking
  938.  
  939.  
  940. For Stta mode, Mark File will return the first 35 characters of each command
  941. which begins a new line.  Therefore it should not include any indented or
  942. continued commands.  Headings will be marked, defined by three (and only
  943. three) comment characters and a space at the start of a line.  Subheadings
  944. are indicated by four comment characters.
  945.  
  946.  
  947.     The File                    The Mark
  948.     ________                    ________
  949.  
  950.     *** Section Heading         • Section Heading
  951.     **** Subsection Heading     * Subsection Heading
  952.     command varlist (options)     command varlist (options)
  953.  
  954.  
  955. Function parsing {} will return only the command names, in alphabetical order.
  956.  
  957. Mark File mode will check to see if the current window is a .do or .ado
  958. file.  If it is not, it will assume that it is an output file, and Alpha
  959. will adjust its marking and parsing routines accordingly.  
  960.  
  961. There is also a special marking routine for files produced by the .codebook
  962. command, available in the "Stata --> Mark Stata File As …" menu.  Mark File
  963. will then contain only the variable names, and list them in alphabetical
  964. order.  Extremely handy for data sets with a lot of variables.
  965.  
  966.  
  967.                Adding a Stata Prefs file
  968.  
  969.  
  970. To add additional commands or arguments in a "SttaPrefs.tcl" file, go to
  971. "Config --> Mode Prefs --> Edit Prefs File", and add these lines:
  972.  
  973.  
  974.     set SttaUserCommands {
  975.         blah bladdity
  976.     }
  977.     
  978.     set SttaUserOptions {
  979.         blah2 bladdity2
  980.     }
  981.     
  982.     Stta::colorizeStta
  983.  
  984.  
  985. Include as many keywords as desired within the braces, separating each
  986. keyword by at least one space or carriage return.  Alpha will automatically
  987. load this preferences file the first that the Stta mode is invoked.
  988.  
  989. Any keywords contained in these categories will not only be colorized, but
  990. will also be included as electric completions.  Don't repeat commands or
  991. options that have already been defined.
  992.  
  993. To modify the text inserted by the "Program Template" menu item, place this
  994. procedure in a "SttaPrefs.tcl" file, and modify the text defined in the
  995. "pt" variable:
  996.  
  997.     proc Stta::programTemplate {} {
  998.     
  999.         Stta::SttaModeMenuItem
  1000.         
  1001.         global SttamodeVars
  1002.         
  1003.         set end [lindex [Stta::getCommand [getPos]] 1]
  1004.         if {$end != "-1" && $end > [getPos]} {
  1005.             goto $end
  1006.         }
  1007.         if {$SttamodeVars(semiDelimiter)} {
  1008.             set eol " ;\r"
  1009.         } else {
  1010.             set eol "\r"
  1011.         } 
  1012.         
  1013.         set    pt "program define •progname•${eol}\tversion 6.0${eol}\tif \"`1'\""
  1014.         append pt " == \"?\" {\r\t\tglobal S_1 \"•variable names•\"${eol}\t\t"
  1015.         append pt "exit${eol}\t}${eol}\t••\r\t* (each result below must correspond"
  1016.         append pt " to a variable in S_1)${eol}\tpost `1' •results•${eol}end${eol}"
  1017.         elec::Insertion $pt
  1018.     }
  1019.  
  1020.  
  1021.  
  1022.                Stta mode Known Bugs
  1023.  
  1024.  
  1025. If you use a profile.do file to execute a set of commands automatically
  1026. whenever Stata is launched (as is suggested above), then you must wait a
  1027. few moments (depending upon the speed of your computer and what commands
  1028. are in the file) after launching Stata before it is ready to respond to
  1029. your input.  Stta mode doesn't know this, and therefore when you send a
  1030. file or a selection to Stata for processing without Stata already running,
  1031. Stata is launched and the file sent so quickly that an error may occur.  If
  1032. you are experiencing this problem, use shift-cmd-S to launch Stata first.
  1033.  
  1034.           
  1035.     ======================================================================
  1036.  
  1037.  
  1038.           Latest Versions
  1039.  
  1040.  
  1041. The latest versions of these modes will be available at
  1042.  
  1043.     <http://www.princeton.edu/~cupright/computing/alpha/>
  1044.  
  1045. Updated versions will also be posted to Vince's upload site, 
  1046.  
  1047.     <ftp://ftp.ucsd.edu/pub/alpha/>
  1048.  
  1049. and announced on the ALPHA-D mailing list.  This is a mailing list for
  1050. Alpha where you can discuss problems, suggest new features etc.  To
  1051. subscribe, email <listserv@listserv.syr.edu> and, in the body of your
  1052. message (not the subject line), write:
  1053.  
  1054.     SUBSCRIBE ALPHA-D
  1055.  
  1056.  
  1057.           Future Versions
  1058.  
  1059.  
  1060. These modes are submitted to the Alpha community with the hopes that (i)
  1061. somebody else will find them useful, (ii) any errors or updates will be
  1062. reported to the mode's maintainer, and (iii) they might inspire somebody to
  1063. take them even further.  I will continue to maintain them and post updates
  1064. as necessary, but any contributions are certainly welcome.
  1065.  
  1066. Commercial statistical packages are updated with some regularity.  
  1067. Chances are that the keyword dictionaries contained herein will need an 
  1068. occasional facelift.  Don't be shy, especially if you have a manual for 
  1069. the newer versions handy.
  1070.  
  1071. Could Alpha be used as a front end for any of SAS or SPSS? I don't know. 
  1072. To be honest, I've never used any of these statisical packages on a
  1073. Macintosh before -- I have always worked in an academic setting which has
  1074. provided site licenses for the Unix versions.  I do all of my text-editing
  1075. work on a Macintosh, however, saving the files in my Unix account.  When I
  1076. need to actually run the syntax files, I do so with a telnet window.
  1077.  
  1078. This is admittedly an idiosyncratic arrangement -- but it's all based on
  1079. division of labor needs, for which Alpha is ideally suited.  I have neither
  1080. the Tcl nor the Apple Event knowledge to try to make Alpha interface with
  1081. these programs.  If anybody else wants to give it a try ...
  1082.  
  1083.  
  1084.           License and Disclaimer
  1085.  
  1086.  
  1087. This library is free software; you can redistribute it and/or modify it
  1088. under the terms of the GNU Library General Public License as published by
  1089. the Free Software Foundation; either version 2 of the License, or (at your
  1090. option) any later version.
  1091.  
  1092. This library is distributed in the hope that it will be useful, but WITHOUT
  1093. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  1094. FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
  1095. License for more details.
  1096.  
  1097. You should have received a copy of the GNU Library General Public License
  1098. along with this library; if not, write to the Free Foundation, Inc., 59
  1099. Temple Place, Suite 330, Boston, MA 02111-1307 USA
  1100.  
  1101. These modes are free.  Alpha is shareware !   <<register>>
  1102.  
  1103.  
  1104. cheers,
  1105.  
  1106. -- Craig
  1107.  
  1108.  
  1109.  Author: Craig Barton Upright
  1110.  E-mail: <cupright@princeton.edu>
  1111.    mail: Princeton University,  Department of Sociology 
  1112.          Princeton, New Jersey  08544  USA
  1113.     www: <http://www.princeton.edu/~cupright/>
  1114.  
  1115.